#ifndef ECGSEEKPEAKS_H
#define ECGSEEKPEAKS_H
#include "beats.h"
#include "ecg.h"

#include <QDebug>
#include <QObject>
#include <QPointF>
#include <QVector2D>

class EcgSeekPeaks : public QObject {
    Q_OBJECT
public:
    explicit EcgSeekPeaks(QObject* parent = nullptr);
    void recognition(QVector<float>& ecgSignalData);

private:
    enum MARK_QRS {
        MARK_NO_QRS,
        MARK_QRS
    };
    Beats& beatsModel = Beats::getInstance();
    Ecg& ecg = Ecg::getInstance();
    void avgFilter(QVector<float>& ecgSignalData);
    float percentiles(const QVector<float>& data, int percent);
    void rPeakPositions(const QVector<float>& signal, QVector<int>& result, int min_rr_width);
    void findPeaks(const QVector<float>& signal, QVector<int>& peakValleyPositions);
    QHash<QString, double> angleDotProduct(const QPointF& o, const QPointF& first, const QPointF& second);
    void setNormalNTemp(const QList<int>& preRPeaks,const QHash<int, QHash<unsigned char, int16_t>>& beatsData, const QMap<int, QHash<QString, float>>& allRPeaks, const QVector<float>& signal, QHash<QString, float>& normalNTemp);
    float averageMedian(const QList<float> listData);
signals:
};

#endif // ECGSEEKPEAKS_H
